#ifndef GAMEKIT_COMPONENT_H
#define GAMEKIT_COMPONENT_H

#include <vector>

#include "gamekit.h"
#include "common/SafePointer.h"
#include "common/SharedPointer.h"
#include "drawing/Canvas.h"

namespace gamekit
{
	class Scene;
	class Window;

	EXPORT_STL_VECTOR(GK_API, SharedPointer<Canvas>)

	class GK_API Component
	{
		friend class Scene;

	public:
		Component(SafePointer<Scene> scene);
		virtual ~Component();

		SafePointer<Scene> scene(void) const;
		SafePointer<Window> window(void) const;

		bool isInitialized(void) const;

	protected:
		void virtual onInit(void);
		void virtual onUpdate(const uint& elapsed);

		void add(SharedPointer<Canvas> drawing);

		std::vector<SharedPointer<Canvas> > canvases(void) const;

	private:
		void init(void);
		void update(const uint& elapsed);

	private:
		SafePointer<Scene> m_scene;
		std::vector<SharedPointer<Canvas> > m_canvases;
		bool m_initialized;
	};
}

#endif
